import java.awt.*;
import java.awt.event.InputEvent;
//import java.awt.event.*;


public class DesktopMaster {
	
	private static Robot robot;

	public static void main(String[] args)throws AWTException {
		setRobot(new Robot());
	}
	
	public void moveMouse(int iX, int iY){
		getRobot().mouseMove(iX, iY);
	}
	
	public void rotateWheel(int iRotation){
		getRobot().mouseWheel(iRotation);
	}
	
	public void dragMouse(int iButton, int iX, int iY){
		pressMouse(iButton);
		getRobot().delay(250);
		moveMouse(iX, iY);
	}
	
	public void releaseMouse(int iDelay, int iButton){
		getRobot().delay(iDelay);
		
		switch(iButton){
		case 1:{
			getRobot().mouseRelease(InputEvent.BUTTON1_MASK);
			break;
		}
		case 2:{
			getRobot().mouseRelease(InputEvent.BUTTON2_MASK);
			break;
		}
		case 3:{
			getRobot().mouseRelease(InputEvent.BUTTON3_MASK);
			break;
		}
		default:{
			break;
		}
		
		}
	}
	
	public void pressMouse(int iButton){
	
		switch(iButton){
		case 1:{
			getRobot().mousePress(InputEvent.BUTTON1_MASK);
			break;
		}
		case 2:{
			getRobot().mousePress(InputEvent.BUTTON2_MASK);
			break;
		}
		case 3:{
			getRobot().mousePress(InputEvent.BUTTON3_MASK);
			break;
		}
		default:{
			break;
		}
		
		}
	}
	
	public void clickMouse(int iCount, int iButton){
		
		for(int i=0; i<iCount; i++){
			pressMouse(iButton);
			releaseMouse(500, iButton);
		}
	}
	
	public Robot getRobot(){
		return robot;
	}
	
	private static void setRobot(Robot tmpRobot){
		robot = tmpRobot;
	}
	

}
